//将明文密码替换成*号
export function replacePassword(str) {
  return str.replace(/./g, '*')
}

//将云url地址转换成http
export function cloudUrlToHttps(url) {
  //获取云id
  const cloudId = url.split('/')[2]

  //在云id后面插入静态地址后缀
  const newUrl = url.replace(cloudId, `${cloudId}.normal.cloudstatic.cn`)

  //替换
  return newUrl.replace('cloud://', 'https://')
}

//将地区对象转换成字符串
export function formatRegion(region) {
  if (!region) return

  const {province, city, area} = region
  return province + city + area
}
